package com.simple.core;

import com.simple.manager.impl.InstanceManager;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public abstract class AbsReceiver implements Receiver {

    protected List<String> actions;

    public AbsReceiver() {
        actions = new ArrayList<>();
    }

    @Override
    public void addAction(String action) {
        if (actions.contains(action)) {
            return;
        }
        actions.add(action);
    }

    @Override
    public void register() {
        Center center = (Center) InstanceManager.getInstance().lookup(Center.class.getName());
        center.register(this);
    }

    @Override
    public List<String> getActions() {
        return actions;
    }
}
